Skip to content

chore: add install-flex, fix Blacksmith ARM64 CI (build tools + test timeouts), fix per-branch DB#11

Merged
lgarceau768 merged 9 commits intoflexfrom
chore/bolster-install
Apr 23, 2026
Merged

chore: add install-flex, fix Blacksmith ARM64 CI (build tools + test timeouts), fix per-branch DB#11
lgarceau768 merged 9 commits intoflexfrom
chore/bolster-install

Conversation

@lgarceau768
Copy link
Copy Markdown
Collaborator

@lgarceau768 lgarceau768 commented Apr 22, 2026

Summary

  • Add install-flex: single curl | bash installer (clone flex branch, build binary, write AWS SSO config, append opencode-work(); idempotent)
  • Fix session loss on rebuild: pin OPENCODE_CHANNEL=flex so all Flexion fork builds share opencode-flex.db
  • Fix Blacksmith ARM64 CI — four failure layers peeled back incrementally:
    1. unzip missing → bun zip extraction fails
    2. make/g++ missing → node-gyp can't build tree-sitter-powershell
    3. @opencode-ai/plugin npm fetch per test → plugin/tool tests timeout at 30 s
    4. Resource contention from parallel arborist installs → session/snapshot tests timeout

Blacksmith ARM64 runner — failure layers

Layer Root cause Fix
setup-bun unzip not installed Install unzip + build-essential if absent (Linux only)
bun install make/g++ not installed Same step above: install build-essential
Plugin/tool tests @npmcli/arborist.reify() runs per-test, fetches from npm (10–30 s each) New OPENCODE_DISABLE_PLUGIN_DEPS_INSTALL flag skips the install; set in test/preload.ts
Session/snapshot tests Parallel arborist fetches saturate 4-vCPU runner Resolved by eliminating arborist installs above
revert handles large mixed batches (280 files) Git ops on ARM64 can approach 30 s Raise test timeout to 60 s

Why OPENCODE_DISABLE_PLUGIN_DEPS_INSTALL is safe for tests:
config.ts fires a background @npmcli/arborist.reify() for @opencode-ai/plugin in every .opencode/ directory, then plugin/index.ts and tool/registry.ts call waitForDependencies() before loading plugins/tools. In production this ensures user-authored plugins can import { … } from "@opencode-ai/plugin". In tests, bun resolves @opencode-ai/plugin from the monorepo workspace node_modules directly — no per-test install needed.

Session loss fix (per-branch DB fragmentation)

OpenCode bakes InstallationChannel from the current git branch at build time and names the SQLite DB after it. Every branch rebuild created a new empty database. OPENCODE_CHANNEL=flex in install-flex pins the channel so all Flexion builds share opencode-flex.db.

Changes

  • .github/actions/setup-bun/action.yml — build tools prereq step + ARM64/X64 URL construction
  • .github/workflows/test.yml — npm cache + pre-warm (belt-and-suspenders; primary fix is the flag)
  • packages/opencode/src/flag/flag.tsOPENCODE_DISABLE_PLUGIN_DEPS_INSTALL flag
  • packages/opencode/src/config/config.ts — guard arborist install with flag
  • packages/opencode/test/preload.ts — set flag + comment
  • packages/opencode/test/snapshot/snapshot.test.ts — 60 s timeout for 280-file revert test
  • install-flex — new installer, OPENCODE_CHANNEL=flex build flag
  • LOCAL_AWS_SETUP.md — Quick Install section

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

- add install-flex: single curl | bash installer that clones the flex
  branch, builds the binary, writes the AWS SSO profile, writes
  ~/.config/opencode/opencode.json, and appends opencode-work() to
  the user's shell rc file; all steps are idempotent
- hardcode SSO start URL and us-east-2 SSO region; prompt only for
  account ID and preferred AWS region
- correct sso_role_name from AdministratorAccess to ClaudeCodeAccess
- fix opencode-work(): replace undeclared \${opencode_args[@]} with
  "\$@", replace hardcoded path and arch with runtime uname detection
- add Quick Install section to LOCAL_AWS_SETUP.md
@lgarceau768 lgarceau768 self-assigned this Apr 22, 2026
@github-actions
Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

…B fragmentation

Without this, every build bakes the current git branch name as the installation
channel, causing OpenCode to open a new empty SQLite database each time you
rebuild from a different branch (opencode-chore-bolster-install.db,
opencode-feat-mcp-awareness.db, etc). Setting OPENCODE_CHANNEL=flex means all
Flexion fork builds share opencode-flex.db regardless of which branch was built.
@lgarceau768 lgarceau768 changed the title chore: add install-flex automated setup script and update docs chore: add install-flex script and fix per-branch DB fragmentation on rebuild Apr 22, 2026
…unners

Blacksmith's ubuntu-2404 runners run on ARM64 hardware (RUNNER_ARCH=ARM64).
The previous action only built an explicit bun download URL for X64, so ARM64
fell through to oven-sh/setup-bun@v2's default path which downloads
bun-linux-aarch64.zip and extracts it via the system unzip command. Blacksmith's
ARM64 Ubuntu image doesn't pre-install unzip, causing all e2e and unit CI jobs
to fail at the Setup Bun step.

Two changes:
- Add a Linux step that installs unzip if not already present (direct fix)
- Rewrite the URL construction with case/esac covering both X64 and ARM64 for
  all OS variants, replacing the x64-only if block (architecture fix)
@lgarceau768 lgarceau768 changed the title chore: add install-flex script and fix per-branch DB fragmentation on rebuild chore: add install-flex, fix ARM64 CI, and fix per-branch DB fragmentation Apr 22, 2026
…ion on ARM64

tree-sitter-powershell builds a native addon via node-gyp during bun install.
Blacksmith ARM64 runners don't pre-install make or g++, so the build fails with:

  gyp ERR! not found: make

Extend the prerequisite step to also check for make and install build-essential
(which provides make + g++) when missing, alongside the existing unzip check.
@lgarceau768 lgarceau768 changed the title chore: add install-flex, fix ARM64 CI, and fix per-branch DB fragmentation chore: add install-flex, fix ARM64 CI runner deps, fix per-branch DB fragmentation Apr 22, 2026
…in test timeouts

Plugin integration tests (auth-override, plugin config providers) each create a
fresh temp dir and trigger @npmcli/arborist to install @opencode-ai/plugin from
the npm registry. On Blacksmith ARM64, this network fetch takes 10-30 s per
test, consistently hitting the 30 s bun test timeout.

Two changes to the unit job in test.yml:
- Cache ~/.npm across runs so arborist finds tarballs locally on repeat runs
- Pre-warm step: npm install @opencode-ai/plugin once before tests run, which
  populates ~/.npm so arborist's per-test installs resolve from cache (~0.5 s)
  rather than the network (~10-30 s)
@lgarceau768 lgarceau768 changed the title chore: add install-flex, fix ARM64 CI runner deps, fix per-branch DB fragmentation chore: add install-flex, fix Blacksmith ARM64 CI deps, fix per-branch DB fragmentation Apr 22, 2026
…t timeout

Root cause of all 7 test timeouts:

  config.ts fires a background @npmcli/arborist.reify() for @opencode-ai/plugin
  in every .opencode/ directory it discovers. plugin/index.ts and tool/registry.ts
  then call waitForDependencies() which joins that fiber before loading plugins
  or custom tools. On Blacksmith ARM64, a cold arborist fetch takes 10-30 s per
  test. Running in parallel across a 4-vCPU runner saturates CPU/IO and starves
  even unrelated tests (session.processor, snapshot.revert) past their 30 s limit.

Fixes:
  - flag.ts: add OPENCODE_DISABLE_PLUGIN_DEPS_INSTALL flag
  - config.ts: guard the npmSvc.install() + deps.push() block with the new flag
  - preload.ts: set OPENCODE_DISABLE_PLUGIN_DEPS_INSTALL=true for all tests
    (safe: bun resolves @opencode-ai/plugin from the workspace node_modules;
    tests do not author plugins that import the SDK at runtime)
  - snapshot.test.ts: raise timeout on the 280-file revert test to 60 s
    (git operations across 280 files can push past 30 s on ARM64)
@lgarceau768 lgarceau768 changed the title chore: add install-flex, fix Blacksmith ARM64 CI deps, fix per-branch DB fragmentation chore: add install-flex, fix Blacksmith ARM64 CI (build tools + test timeouts), fix per-branch DB Apr 22, 2026
Blacksmith ARM64 runner subprocess startup overhead can consume 2-3 s,
pushing the 'loop waits while shell runs' test past its 3 s failsafe.
The test validates ordering (loop waits while shell is running), not wall
time, so a larger timeout doesn't change what is being tested.
@lgarceau768 lgarceau768 merged commit 26c09fd into flex Apr 23, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant